export function generateColorByNumber(num = 0) {
  // 确保输入的数字在合理范围内
  num = Math.max(0, Math.min(255, num)); // 限制在 0 到 255 之间

  // 计算 RGB 分量
  const red = num;
  const green = 255 - num;
  const blue = (num + 128) % 256;

  // 将 RGB 分量转换为十六进制颜色表示
  const color =
    "#" + componentToHex(red) + componentToHex(green) + componentToHex(blue);

  return color;
}
function componentToHex(c: number) {
  const hex = c.toString(16);
  return hex.length === 1 ? "0" + hex : hex;
}
export function TinyColor(num = 0) {
  const i = (num % 255) * 68;
  return generateColorByNumber(i);
}

export const getRandom = (): number => {
  const colors: number[] = [
    0x0eaa97, 0x88cccc, 0x109fb1, 0xffffff, 0x008899, 0xfc3e77, 0x594f57,
    0x8ad9ec, 0xd49e9e, 0xec5685, 0xcceeee, 0x444444, 0xf5d4c8, 0x000000,
  ];
  return colors[Math.round(Math.random() * colors.length - 1)];
};



export const randomColor = () => {
  return "#" + Math.random().toString(16).slice(2, 8).padEnd(6, "0");
}